package pe.gob.mtpe.renoccsys.mybatis.implementacion;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import pe.gob.mtpe.renoccsys.bean.ParamConsultaRetcc;
import pe.gob.mtpe.renoccsys.mybatis.comun.MyBatisConnectionFactory;
import pe.gob.mtpe.renoccsys.mybatis.interfase.INTRetcc;

public class IMPRetcc implements INTRetcc{
	
	private SqlSessionFactory sqlSessionFactory;
	
	public IMPRetcc(){
		sqlSessionFactory=MyBatisConnectionFactory.getSqlSessionFactory();
	}
	



	@Override
	public List<Map>  consultarRetcc(ParamConsultaRetcc parametro) throws Exception {
		SqlSession session=sqlSessionFactory.openSession();
		List<Map>  lista=new ArrayList<Map>();
		try {				
			lista=session.selectList("Retcc.consultaRetcc", parametro);	
			//lista.get(0).get("");
		} catch (Exception e) {
			System.out.println("Error en IMPRetcc>consultarRetcc: "+e.getMessage());			
		} finally {
			session.close();
		}
		return lista;
	}




	@Override
	public List<Map> emitirCarnet(Integer corrRetcc) throws Exception {
		SqlSession session=sqlSessionFactory.openSession();
		List<Map>  lista=new ArrayList<Map>();
		try {				
			lista=session.selectList("Retcc.emitirCarnet", corrRetcc);	
			
		} catch (Exception e) {
			System.out.println("Error en IMPRetcc>emitirCarnet: "+e.getMessage());			
		} finally {
			session.close();
		}
		return lista;
	}

	

}
